<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <style type="text/css">
   td {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
   }
   .one {
	   background-color: #666666
	   } 
   .two {
	   background-color: #999999
	   }
   .three {
	   background-color: #CCCCCC
	   }
  </style>

<title>Неработающие узлы на карте 'Главная'</title>
</head>
<body>

<table width="900" border="0" align="left" cellpadding="1" cellspacing="1">
<tr width="100%">
	<td colspan="7" bgcolor="#666666"= align="right"><a href="zbx-frontend.html" title="back" target="_self"><b>Back</b></a></td>
</tr>
<tr bgcolor="#999999"><td><b>ip</b></td> <td><b>name</b> (+профиль)</td> <td><b>расположение</b></td> <td><b>ссылка на последние данные</b></td> <td><b>время падения</b> (тест)</td></tr>

<?php
include("inc.db.conf.php");
$query = "
SELECT
      hosts.ip, hosts.hostid, hosts.host, hosts_profiles.location, FROM_UNIXTIME(triggers.lastchange)
FROM
    zabbix.items
    INNER JOIN zabbix.hosts 
        ON (items.hostid = hosts.hostid)
    INNER JOIN zabbix.hosts_profiles 
        ON (hosts.hostid = hosts_profiles.hostid)
    INNER JOIN zabbix.functions 
        ON (functions.itemid = items.itemid)
    INNER JOIN zabbix.triggers 
        ON (triggers.triggerid = functions.triggerid)
    INNER JOIN zabbix.sysmaps_elements 
        ON (sysmaps_elements.elementid = hosts.hostid)
    INNER JOIN zabbix.sysmaps 
        ON (sysmaps_elements.sysmapid = sysmaps.sysmapid)
WHERE   items.lastvalue LIKE '0'
        AND items.description LIKE 'ping_check'
		AND triggers.description LIKE 'down'
        AND hosts.status LIKE '0'
        AND sysmaps.sysmapid LIKE '17'";
$result=mysql_query($query, $link) or die(mysql_errno($link).mysql_error($link));

while($row = mysql_fetch_array( $result )) {
echo "<tr bgcolor=#CCCCCC><td width=120>".$row['ip']. "</td>
<td width=170><a href=http://zabbix.telsycom.local/hostprofiles.php?prof_type=0&amp;hostid=".$row['hostid'].">".$row['host']."</td>
<td width=30%>".$row['location']."</td>
<td width=130><a href=http://zabbix.telsycom.local/latest.php?open=1&amp;hostid=".$row['hostid'].">последние данные</a></td>
<td width=150>".$row['FROM_UNIXTIME(triggers.lastchange)']."</td>
</tr>\n";
}


?>

</table>
</body>
</html>
